"""

查看数据轴向spacing分布
查看各数据的维度
"""

import os
import sys
sys.path.append(os.path.split(sys.path[0])[0])

import SimpleITK as sitk

from config import zhongShanParameter as para
import numpy as np




#加载两样标签的数据
vol_root_path=para.nii_volume_path
seg_root_path=para.nii_seg_path
volume_name_list=os.listdir(vol_root_path)
seg_name_list=os.listdir(seg_root_path)



for volume_name,seg_name in zip(volume_name_list,seg_name_list):

    ct = sitk.ReadImage(os.path.join(vol_root_path, volume_name), sitk.sitkInt16)
    ct_array=sitk.GetArrayFromImage(ct)

    seg = sitk.ReadImage(os.path.join(seg_root_path, seg_name), sitk.sitkInt16)
    seg_array = sitk.GetArrayFromImage(ct)
    print(volume_name,ct_array.shape,seg_array.shape,"spacing: ",ct.GetSpacing()[-1],seg.GetSpacing()[-1])





